<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>订单列表</title>
	<script type="text/javascript" src="<%=basePath%>skin/js/jquery-1.9.1.min.js"></script>
	<script language="javascript">
	$().ready(function(){
		$("#export").click(function(){
			$("#form1").attr("action","<%=basePath%>admin/order/export.shtml");
			$("#form1").submit();
			$("#form1").attr("action","<%=basePath%>admin/order/list.shtml");
			return false;
		});
		
		$("select[name=jumpmenu]").each(function(){
			$(this).change(function(){
				var jmurl = $(this).children("option:selected").val();
				window.open(jmurl);
			});
		});
	});
	</script>
  </head>
  
  <body background='skin/images/allbg.gif'>
	  <form action="<%=basePath%>admin/order/list.shtml" id="form1" name="form1" method="get">
		  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#D1DDAA" align="center">
			  <tr>
			  	<td align="left">
			  		<input type="button" id="export" name="export" value="导出"/>
			  	</td>
				<td align="right">
					<select name="field">
						<option value="sn">编号</option>
					</select>
					<input name="keyword" type="text" id="keyword" value="${paramBean.keyword }" size="20" />
			  		<input type="submit" name="add" value="查询"/>
			  	</td>
			  </tr>
		  </table>
	  </form>
	  <table width="100%" border="0" class="onelineTable" cellpadding="2"
			cellspacing="1" bgcolor="#D1DDAA" align="center">
			<tr align="center" bgcolor="#E7E7E7" height="22">
				<td width="10%">
					编号
				</td>
				<td width="10%">
					金额
				</td>
				<td width="10%">
					会员
				</td>
				<td width="10%">
					收货人
				</td>
				<td width="8%">
					支付方式名称
				</td>
				<td width="8%">
					配送方式名称
				</td>
				<td width="5%">
					订单状态
				</td>
				<td width="5%">
					支付状态
				</td>
				<td width="5%">
					配送状态
				</td>
				<td width="14%">
					创建日期
				</td>
				<td width="10%">
					打印
				</td>
				<td width="10%">
					操作
				</td>
			</tr>
			<c:forEach items="${pagination.recordList}" var="order">
				<tr align='center' bgcolor="#FFFFFF"
						onMouseMove="javascript:this.bgColor='#FCFDEE';"
						onMouseOut="javascript:this.bgColor='#FFFFFF';" height="22">
			  		<td>${order.sn}</td>
			  		<td><fmt:formatNumber value="${order.amount}" pattern="0.00"/></td>
			  		<td>${order.member.name}</td>
			  		<td>${order.consignee}</td>
			  		<td>${order.paymentMethodName}</td>
			  		<td>${order.shippingMethodName}</td>
			  		<td>${order.orderStatusLabel}</td>
			  		<td>${order.paymentStatusLabel}</td>
			  		<td>${order.shippingStatusLabel}</td>
			  		<td><fmt:formatDate value="${order.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
			  		<td>
			  			<select name="jumpmenu">
			  				<option value="<%=basePath%>admin/print/order.shtml?id=${order.id}">订单打印</option>
			  				<option value="<%=basePath%>admin/print/product.shtml?id=${order.id}">购物单打印</option>
			  				<option value="<%=basePath%>admin/print/shipping.shtml?id=${order.id}">配送单打印</option>
			  			</select>
			  		</td>
			  		<td>
			  		<a href="<%=basePath%>admin/order/view.shtml?id=${order.id}">查看</a><br/>
			  		<a href="<%=basePath%>admin/order/edit.shtml?id=${order.id}">编辑</a><br/> 
			  		<c:if test="${order.paymentStatus==2 && (order.shippingStatus==0 || order.shippingStatus==1)}">
			  		<a href="<%=basePath%>admin/order/stockout.shtml?id=${order.id}">发货</a><br/>
			  		</c:if>
			  		</td>
			  	</tr>
		  	</c:forEach>
			<tr align="right" bgcolor="#EEF4EA">
				<td height="36" colspan="12" align="center">
					${pagination.pageHtml }
				</td>
			</tr>
	  </table>
  </body>
</html>
